
<!doctype html>
<html class="no-js" lang="">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Untitled Document</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="apple-touch-icon" href="apple-touch-icon.png">
    <!-- Place favicon.ico in the root directory -->

    <link rel="stylesheet" type="text/css" href="../../css/reset.css">
</head>

<body>
    <div class="loading">
        <span class="loadImg"></span>
    </div>
    <div class="bannerList">
        <table class="table" >
          <tr>
            <td>id</td>
            <td>订单号</td>
            <td>用户名</td>
            <td>订单电话</td>
            <td>下单时间</td>
            <td>商品</td>
            <td>总价</td>
            <td>状态</td>
            <td>操作</td>
          </tr>
        </table>
    </div>
</body>
<script src="../../js/jquery.js"></script>
<script src="../../js/jquery.cookie.js"></script>
<script type="text/javascript">
    $(function(){
        
        getData();
        function getData(){
            var admintoken=$.cookie('admintoken');
            if(admintoken!=null){
                $('.loading').show();
                $.ajax({
                    type: 'get',
                    url:'http://www.math80.com/order/all?_include=address,order_items,user',
                    headers:{Authorization:"Bearer "+admintoken},
                    success:function(data){
                        var all=data.data;
                        var len=data.data.length;
                        $('.info ul li').not('.top').remove();
                        for(var i=0;i<len;i++){

                            var item="";
                            var _start="";
                            for(var j=0;j<all[i].order_items.length;j++){
                                item+=all[i].order_items[j].goods_name+' * '+all[i].order_items[j].goods_count+'<br>';
                            };
                            if(all[i].status==1){
                                _start="未支付"
                            }else{
                                _start="已发货"
                            };
                            var tr="<tr>"+
                                        "<td>"+all[i].id+"</td>"+
                                        "<td>"+all[i].trade_no+"</td>"+
                                        "<td>"+all[i].order_username+"</td>"+
                                        "<td>"+all[i].order_mobile+"</td>"+
                                        "<td class='left'>"+all[i].created_at+"</td>"+
                                        "<td class='left'>"+item+"</td>"+
                                        "<td>$"+all[i].amount+"</td>"+
                                        "<td>"+_start+"</td>"+
                                        "<td><a class='clicka'>删除</a></td>"+
                                      "</tr>"
                            $('.table').append(tr);
                        }
                        $('.loading').hide();

                    }
                })
            }
        }
        

        


    })

</script>
<style type="text/css">
.info .logo img{display: block !important;}
</style>
</html>